package cn.lsngo.manager;

import android.os.Bundle;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;

import java.util.List;

import cn.lsngo.manager.greendao.ElectricBean;

/**
 * @author : admin
 * @Title :
 * @date : 2021/12/23 15:02
 */
public class HistoryActivity extends AppCompatActivity {

    private Long id;
    private RecyclerView mRecyclerView;
    private TextView mTvContent;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_history);
        id = getIntent().getLongExtra(Constants.IntentInfo, 0);
        mTvContent = (TextView) findViewById(R.id.tv_content);
//        mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
//        LinearLayoutManager manager = new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false);
//        mRecyclerView.setLayoutManager(manager);
//        mRecyclerView.setAdapter();

        queryData();
    }

    private void queryData() {
        ElectricBean electricBean = DataModule.queryElectric(id);
        if (electricBean == null) {
            return;
        }
        String amountMoney = electricBean.getAmountMoney();
        List<ElectricDetailBean> list = electricBean.getList();
        StringBuffer strInfo = new StringBuffer();
        if (list != null && list.size() > 0) {
            for (ElectricDetailBean electricDetailBean : list) {
                String detail = electricDetailBean.getDetail();
                String roomNumber = electricDetailBean.getRoomNumber();
                strInfo.append(roomNumber + "  " + detail + "\n");
            }
        }
        mTvContent.setText(strInfo);
    }
}
